package com.cmict.data.system.api.conf;

import com.cmict.data.system.api.conf.dto.ConfSystemDTO;
import com.cmict.data.system.controller.admin.conf.vo.ConfSystem;
import com.cmict.data.system.convert.conf.ConfConvert;
import com.cmict.data.system.enums.ApiConstants;
import com.cmict.data.system.service.conf.ConfService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 部门 API 实现类
 *
 * @author awesome
 */
@RestController // 提供 RESTful API 接口，给 Feign 调用
@DubboService(version = ApiConstants.VERSION) // 提供 Dubbo RPC 接口，给 Dubbo Consumer 调用
@Validated
public class ConfApiImpl implements ConfApi {

    @Resource
    private ConfService confService;
    @Override
    public ConfSystemDTO getConfValueByConfKey(String confKey) {
        ConfSystem confValueByConfKey = confService.getConfValueByConfKey(confKey);
        ConfSystemDTO confSystemDTO =  ConfConvert.INSTANCE.convertDTD(confValueByConfKey);
        return confSystemDTO;
    }
}
